import org.wall.domain.*

class BootStrap {

    def init = { servletContext ->
    	
    	try {

            // criando usuário admin
            User userADM = new User(username: "adm", password: "adm123")
            userADM.save()
     
            Role roleADM = new Role(authority: "ROLE_ADM")
            roleADM.save()
     
            new UserRole(user: userADM, role: roleADM).save()

            // criando usuário comum    		
            User user = new User(username: "user", password: "user123")
            user.save()
     
            Role roleUser = new Role(authority: "ROLE_USER")
            roleUser.save()
     
            new UserRole(user: user, role: roleUser).save()
    	
    	} catch(Exception e) {
    		print e
    	}
    	
    }
    
    def destroy = {
    }
}
